package com.consumer0.listener;

import com.jobs.common.consts.RabbitCons;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 *
 * @author xdh
 */
@Component
@Slf4j
public class RabbitListenerConfig {

    public static final String EXCHANGE_DIRECT = "exchange.direct.order";

    public static final String ROUTING_KEY = "routing.direct.order";

    public static final String QUEUE_KEY = "queue.direct.order";

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = QUEUE_KEY, durable = "true"),
            exchange = @Exchange(value = EXCHANGE_DIRECT),
            key = {ROUTING_KEY}
    ))
    public void rabbitLs(String dateString, Message message, Channel channel) {
        System.out.println("消息端接收消息:"+dateString);
    }
}
